import { Table, Column, Model } from "sequelize-typescript";
import {User} from "./User"
//var UUID = require("uuid");
@Table({
  tableName: "t_b_department",
})
export default class Department extends Model<Department> {
  @Column({
    primaryKey: true,
    autoIncrement: true,
  })
  dId: number = 0;
  @Column
  level: number = 1;
  @Column
  name: string = "";
  @Column
  note: string = "";
  @Column
  parentId: number = 0;

  async findUsers():Promise<User[]>{
    let users = await User.findAll({
      where:{
        departmentId:this.dId
      }
    })
    return users
  }
}
